package com.tanhua.admin.task;

import com.tanhua.admin.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author Lff
 * @date 2022/4/6
 * <p>
 * 定时任务类
 */
@Component
public class AnalysisTask {
    @Autowired
    private AnalysisService analysisService;

    @Scheduled(cron = "* 0/20 * * * ?")
    /**
     *
     * * 0/10 * * * ? *
     * 十分钟统计一次数据
     */
    public void analysis() {
        try {
            analysisService.analysis();
        } catch (Exception e){
            e.printStackTrace();
        }
    }
}
